package com.zishi.venuesbooking.ac;

import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.bumptech.glide.Glide;
import com.zishi.venuesbooking.BaseActivity;
import com.zishi.venuesbooking.R;

import org.json.JSONException;

import java.io.IOException;

import de.hdodenhof.circleimageview.CircleImageView;

public class MyActivity extends BaseActivity {

    private LinearLayout mMyinfoLayout;
    private LinearLayout mMyrecordsLayout;
    private LinearLayout mMypurchaseLayout;
    private LinearLayout mMynoticeLayout;
    private  CircleImageView mMyAvatar;

    @Override
    protected int initLayout() {
        return R.layout.activity_my;
    }

    @Override
    protected void initView() {
        mMyinfoLayout = findViewById(R.id.myInfoLayout);
        mMyrecordsLayout = findViewById(R.id.myRecordsLayout);
        mMypurchaseLayout = findViewById(R.id.myPurchaseLayout);
        mMynoticeLayout = findViewById(R.id.myNoticeLayout);
        mMyAvatar = findViewById(R.id.userImage);
    }

    @Override
    protected void initData() throws JSONException, IOException {
        // TODO: Implement this method
        // 加载头像
        Glide.with(this)
                .load("file:///android_asset/images/friend/avata_6.png")
                .placeholder(R.drawable.avata_1)
                .into(mMyAvatar);
        initListener();
    }

    protected void initListener() {
        mMyinfoLayout.setOnClickListener(v -> {
            navigateToWithSlowAnimation(MyInfoActivity.class);
        });
        mMyrecordsLayout.setOnClickListener(v -> {
            navigateToWithSlowAnimation(MyRecordsActivity.class);
        });
        mMypurchaseLayout.setOnClickListener(v -> {
            navigateToWithSlowAnimation(MyPurchaseActivity.class);
        });
        mMynoticeLayout.setOnClickListener(v -> {
            navigateToWithSlowAnimation(ReserveActivity.class);
        });
    }
}